package com.cnkvha.trackcontestmgmt;

import java.util.Collections;
import java.util.List;

public enum UserType {

    BEGIN("发令员"),
    TIMER("裁判:计时员"),
    SEQUENCER("裁判:计次员"),
    RECTIFIER("成绩校正员")
    ;

    private final String readable_name;

    UserType(String readable_name) {
        this.readable_name = readable_name;
    }

    private String password;
    private List<String> allowed_identifiers;

    public String getReadableName() {
        return readable_name;
    }

    public String getPassword() {
        return password;
    }

    public void setAllowedIdentifiers(List<String> allowed_identifiers) {
        this.allowed_identifiers = Collections.unmodifiableList(allowed_identifiers);
    }

    public List<String> getAllowedIdentifiers() {
        return allowed_identifiers;
    }

    public boolean isAllowedIdentifier(String identifier) {
        return allowed_identifiers.contains(identifier);
    }

    public void setPassword(String password) {
        this.password = password;
        TrackContestManagement.log("[%s]登陆密码修改成功! ", readable_name);
    }
}
